set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

Create PROCEDURE [dbo].[sp_Categories_getLeafs] 
-- Add the parameters for the stored procedure here 
AS
BEGIN
select A.ID,
A.[Name],
A.NameVN,
A.Rank,
A.LinkedID,
A.Level,
A.Status,
A.Image,
A.Decribes,
(select B.NameVN from dbo.[Categories] as B where A.LinkedID=B.ID) as ParentName
from  dbo.[Categories] as A
where A.ID not in (select LinkedID from dbo.[Categories])
order by A.Rank ASC
END
